package cate.game.role.farm;

import cate.game.event.RoleEventPublisher;
import cate.game.fight.FightTaskContext;
import cate.game.log.GameLoggerFactory;
import cate.game.play.proce.play.PlayPO;
import cate.game.role.Role;
import org.slf4j.Logger;

public abstract class AbstractFarmFTC<T extends IFarm> extends FightTaskContext implements RoleEventPublisher {
    protected Logger log;
    protected abstract T po(Role role);

    protected void setup(Role role) {
        this.funcId = po(role).getFightFuncId();
        log = GameLoggerFactory.getLogger(role.getGame(), this.getClass());
    }

    @Override
    public void handleResult(Role role, PlayPO playPO) {
        po(role).endFighting();
    }
}
